<?php
    $date = date("Y-m-d");
    $pass = rand(1000,9999);
    $filename = './password/'.$date.'.txt';
    $file = fopen($filename,"w") or die("文件创建失败");
    if(file_exists($filename)){
        die("今个已经设置过一次了 别再玩手机了");
    };
    $reslut = fwrite($file,$pass);
    if($reslut == 4){
        echo "密码已生成";
    }else{
        return "生成失败";
    }